
VC_ROOT = $(HOME)/rpi/vc

CFLAGS = -DSTANDALONE -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -U_FORTIFY_SOURCE -Wall -ggdb -ftree-vectorize -pipe -DHAVE_LIBBCM_HOST -DUSE_EXTERNAL_LIBBCM_HOST -DUSE_VCHIQ_ARM -Wno-psabi

LDFLAGS = -L$(VC_ROOT)/lib/ -lbcm_host -lvcos -lvchiq_arm -lpthread -lrt -lm

INCLUDES = -I$(VC_ROOT)/include/ -I$(VC_ROOT)/include/interface/vcos/pthreads -I$(VC_ROOT)/include/interface/vmcs_host/linux

ray_trace_pi: ray_trace_pi.c common.c soft_render.c
	arm-linux-gnueabihf-gcc $(CFLAGS) $(INCLUDES) $^ -o $@ -Wl,--whole-archive $(LDFLAGS) -Wl,--no-whole-archive -rdynamic

    
#########################################################

ray_trace_fb: ray_trace_fb.c common.c soft_render.c
	arm-linux-gnueabihf-gcc  $^ -o $@ -lm -lrt -O2

ray_trace: ray_trace_fb.c common.c soft_render.c
	gcc  $^ -o $@ -lm -lrt -O2